/**
 *
 * Created by bunny on 2017/8/22.
 */

(function ($) {

    $(document).ready(function () {

        $('#btn-login').click(function () {
            var nameid = document.getElementById("user-name").value.trim();
            var password = document.getElementById("user-pass").value.trim();


            if (nameid != "" && password != "") {
                $.ajax({
                    url: '/account/login',
                    data: {name: nameid, pass: password},
                    dataType: 'json',
                    type: 'post'
                }).success(function (data) {
                    console.log(data);
                    if (data.code == true) {
                        window.location.href = "/dashboard";
                    }
                });
            } else {
                alert("请输入完整登陆信息");
                return false;
            }
        });
    });

}(jQuery));
